
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

drop table if exists sys_dept;

drop table if exists sys_dict;

drop table if exists sys_dict_detail;

drop table if exists sys_job;

drop table if exists sys_log;

drop table if exists sys_menu;

drop table if exists sys_role;

drop table if exists sys_roles_depts;

drop table if exists sys_roles_menus;

drop table if exists sys_user;

drop table if exists sys_users_jobs;

drop table if exists sys_users_roles;

drop table if exists tool_email_config;

/*==============================================================*/
/* Table: sys_dept                                              */
/*==============================================================*/
create table sys_dept
(
   dept_id              bigint(20) not null auto_increment comment 'ID',
   pid                  bigint(20) default NULL comment '上级部门',
   sub_count            int(5) default 0 comment '子部门数目',
   name                 varchar(255) default NULL comment '名称',
   dept_sort            int(5) default 999 comment '排序',
   enabled              bit(1) default NULL comment '状态',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (dept_id),
   key AK_Key_2 (pid),
   key AK_Key_3 (enabled)
)
auto_increment = 7;

alter table sys_dept comment '部门';

-- ----------------------------
-- Records of sys_dept
-- ----------------------------
BEGIN;
INSERT INTO `sys_dept` VALUES (1, NULL, 2, '华南分部', 1, b'1', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dept` VALUES (2, NULL, 2, '华北分部', 2, b'1', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dept` VALUES (3, 1, 0, '研发部', 3, b'1', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dept` VALUES (4, 1, 0, '运维部', 4, b'1', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dept` VALUES (5, 2, 0, '测试部', 6, b'1', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dept` VALUES (6, 2, 0, 'UI部门', 7, b'1', 'admin', NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_dict                                              */
/*==============================================================*/
create table sys_dict
(
   dict_id              bigint(20) not null auto_increment comment 'ID',
   name                 varchar(255) not null comment '字典名称',
   description          varchar(255) default NULL comment '描述',
   create_by            varchar(255) default NULL,
   update_by            varchar(255) default NULL,
   create_time          datetime default NULL,
   update_time          datetime default NULL,
   primary key (dict_id)
)
auto_increment = 4;

alter table sys_dict comment '数据字典';

-- ----------------------------
-- Records of sys_dict
-- ----------------------------
BEGIN;
INSERT INTO `sys_dict` VALUES (1, 'user_status', '用户状态', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict` VALUES (2, 'dept_status', '部门状态', 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict` VALUES (3, 'job_status', '岗位状态', 'admin', NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_dict_detail                                       */
/*==============================================================*/
create table sys_dict_detail
(
   detail_id            bigint(20) not null auto_increment comment 'ID',
   dict_id              bigint(20) default NULL,
   `label`              varchar(255) not null comment '字典标签',
   value                varchar(255) default NULL comment '字段值',
   dict_sort            int(5) default NULL comment '排序',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (detail_id),
   key AK_Key_2 (dict_id)
)
auto_increment = 7;

alter table sys_dict_detail comment '数据字典详情';

-- ----------------------------
-- Records of sys_dict_detail
-- ----------------------------
BEGIN;
INSERT INTO `sys_dict_detail` VALUES (1, 1, '激活', 'true', 1, 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict_detail` VALUES (2, 1, '禁用', 'false', 2, 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict_detail` VALUES (3, 2, '启用', 'true', 1, 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict_detail` VALUES (4, 2, '停用', 'false', 2, 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict_detail` VALUES (5, 3, '启用', 'true', 1, 'admin', NULL, now(), NULL);
INSERT INTO `sys_dict_detail` VALUES (6, 3, '停用', 'false', 2, 'admin', NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_job                                               */
/*==============================================================*/
create table sys_job
(
   job_id               bigint(20) not null auto_increment comment 'ID',
   name                 varchar(255) not null comment '岗位名称',
   enabled              bit(1) not null comment '岗位状态',
   job_sort             int(5) default NULL comment '排序',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建时间',
   update_time          datetime default NULL comment '更新时间',
   primary key (job_id),
   unique key AK_Key_2 (name),
   key AK_Key_3 (enabled)
)
auto_increment = 5;

alter table sys_job comment '岗位';

-- ----------------------------
-- Records of sys_job
-- ----------------------------
BEGIN;
INSERT INTO `sys_job` VALUES (1, '人事专员', b'1', 3, 'admin', NULL, now(), NULL);
INSERT INTO `sys_job` VALUES (2, '产品经理', b'1', 4, 'admin', NULL, now(), NULL);
INSERT INTO `sys_job` VALUES (3, '全栈开发', b'1', 2, 'admin', NULL, now(), NULL);
INSERT INTO `sys_job` VALUES (4, '软件测试', b'1', 5, 'admin', NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_log                                               */
/*==============================================================*/
create table sys_log
(
   log_id               bigint(20) not null auto_increment comment 'ID',
   description          varchar(255) default NULL comment '描述',
   log_type             varchar(255) default NULL comment '日志类型',
   method               varchar(255) default NULL comment '方法名',
   params               text comment '参数',
   request_ip           varchar(255) default NULL comment '请求IP',
   time                 bigint(20) default NULL comment '时间戳',
   username             varchar(255) default NULL comment '用户名',
   address              varchar(255) default NULL comment 'IP地址',
   browser              varchar(255) default NULL comment '浏览器',
   exception_detail     text comment '异常信息',
   create_time          datetime default NULL comment '创建时间',
   primary key (log_id),
   key AK_Key_2 (create_time, log_type)
)
auto_increment = 1;

alter table sys_log comment '系统日志';

/*==============================================================*/
/* Table: sys_menu                                              */
/*==============================================================*/
create table sys_menu
(
   menu_id              bigint(20) not null auto_increment comment 'ID',
   pid                  bigint(20) default NULL comment '上级菜单ID',
   sub_count            int(5) default 0 comment '子菜单数目',
   type                 int(11) default NULL comment '菜单类型',
   title                varchar(255) default NULL comment '菜单标题',
   name                 varchar(255) default NULL comment '组件名称',
   component            varchar(255) default NULL comment '组件',
   menu_sort            int(5) default NULL comment '排序',
   icon                 varchar(255) default NULL comment '图标',
   path                 varchar(255) default NULL comment '链接地址',
   i_frame              bit(1) default NULL comment '是否外链',
   cache                bit(1) default 0 comment '缓存',
   hidden               bit(1) default 0 comment '隐藏',
   permission           varchar(255) default NULL comment '权限',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (menu_id),
   unique key AK_Key_2 (title),
   unique key AK_Key_3 (name),
   key AK_Key_4 (pid)
)
auto_increment = 40;

alter table sys_menu comment '系统菜单';

-- ----------------------------
-- Records of sys_menu
-- ----------------------------
BEGIN;
INSERT INTO `sys_menu` VALUES (1, NULL, 7, 0, '系统管理', NULL, NULL, 1, 'system', 'system', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (2, 1, 3, 1, '用户管理', 'User', 'system/user/index', 2, 'peoples', 'user', b'0', b'0', b'0', 'user:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (3, 1, 3, 1, '角色管理', 'Role', 'system/role/index', 3, 'role', 'role', b'0', b'0', b'0', 'roles:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (4, 1, 3, 1, '菜单管理', 'Menu', 'system/menu/index', 4, 'menu', 'menu', b'0', b'0', b'0', 'menu:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (5, 1, 3, 1, '部门管理', 'Dept', 'system/dept/index', 5, 'dept', 'dept', b'0', b'0', b'0', 'dept:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (6, 1, 3, 1, '岗位管理', 'Job', 'system/job/index', 6, 'Steve-Jobs', 'job', b'0', b'0', b'0', 'job:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (7, 1, 3, 1, '字典管理', 'Dict', 'system/dict/index', 7, 'dictionary', 'dict', b'0', b'0', b'0', 'dict:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (132, 1, 3, 1, '客户端管理', 'Client', 'oauth/client/index', 8, 'app', 'client', b'0', b'0', b'0', 'client:list', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (8, NULL, 3, 0, '系统监控', NULL, NULL, 8, 'monitor', 'monitor', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (9, 8, 0, 1, '操作日志', 'Log', 'monitor/log/index', 9, 'log', 'logs', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (10, 8, 0, 1, 'SQL监控', 'Sql', 'monitor/sql/index', 10, 'sqlMonitor', 'druid', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (11, 8, 0, 1, '异常日志', 'ErrorLog', 'monitor/log/errorLog', 11, 'error', 'errorLog', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (12, NULL, 1, 0, '系统工具', NULL, '', 12, 'sys-tools', 'sys-tools', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (13, 12, 0, 1, '接口文档', 'Swagger', 'tools/swagger/index', 13, 'swagger', 'swagger2', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (14, 2, 0, 2, '用户新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'user:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (15, 2, 0, 2, '用户编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'user:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (16, 2, 0, 2, '用户删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'user:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (17, 3, 0, 2, '角色创建', NULL, '', 2, '', '', b'0', b'0', b'0', 'roles:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (18, 3, 0, 2, '角色修改', NULL, '', 3, '', '', b'0', b'0', b'0', 'roles:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (19, 3, 0, 2, '角色删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'roles:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (20, 4, 0, 2, '菜单新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'menu:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (21, 4, 0, 2, '菜单编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'menu:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (22, 4, 0, 2, '菜单删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'menu:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (23, 5, 0, 2, '部门新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dept:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (24, 5, 0, 2, '部门编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dept:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (25, 5, 0, 2, '部门删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dept:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (26, 6, 0, 2, '岗位新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'job:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (27, 6, 0, 2, '岗位编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'job:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (28, 6, 0, 2, '岗位删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'job:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (29, 7, 0, 2, '字典新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'dict:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (30, 7, 0, 2, '字典编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'dict:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (31, 7, 0, 2, '字典删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'dict:del', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (32, NULL, 2, 0, '多级菜单', NULL, '', 900, 'menu', 'nested', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (33, 32, 2, 0, '二级菜单1', NULL, '', 999, 'menu', 'menu1', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (34, 32, 0, 1, '二级菜单2', NULL, 'nested/menu2/index', 999, 'menu', 'menu2', b'0', b'0', b'0', NULL, 'admin',  NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (35, 33, 0, 1, '三级菜单1', 'Test', 'nested/menu1/menu1-1', 999, 'menu', 'menu1-1', b'0', b'0', b'0', NULL, 'admin',  NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (36, 33, 0, 1, '三级菜单2', NULL, 'nested/menu1/menu1-2', 999, 'menu', 'menu1-2', b'0', b'0', b'0', NULL, 'admin',  NULL, now(), NULL);


INSERT INTO `sys_menu` VALUES (37, 12, 0, 1, '邮件工具', 'Email', 'tools/email/index', 14, 'email', 'email', b'0', b'0', b'0', NULL, NULL, NULL, now(), NULL);


INSERT INTO `sys_menu` VALUES (38, NULL, 2, 0, '表单管理', NULL, NULL, 15, 'peoples', 'camunda', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (42, 38, 0, 1, '表单设计', 'Form', 'camunda/form/index', 1, 'peoples', 'form', b'0', b'0', b'0', 'form:list', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (44, NULL, 4, 0, '流程管理flowable', NULL, NULL, 16, 'peoples', 'workflow', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (45, 44, 0, 1, '模型管理', 'Model', 'flowable/model/index', 1, 'peoples', 'flowable/model', b'0', b'0', b'0', 'model:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (46, 44, 0, 1, '流程定义', 'ProcessDefinition', 'flowable/processDefinition/index', 1, 'peoples', 'flowable/definition', b'0', b'0', b'0', 'definition:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (48, 44, 0, 1, '流程实例', 'ProcessInstance', 'flowable/processInstance/index', 1, 'peoples', 'flowable/instance', b'0', b'0', b'0', 'instance:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (49, 44, 0, 1, '任务管理', 'Task', 'flowable/task/index', 1, 'peoples', 'flowable/task', b'0', b'0', b'0', 'task:list', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (120, 45, 0, 2, '模型新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'model:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (121, 45, 0, 2, '模型编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'model:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (122, 45, 0, 2, '模型删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'model:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (123, 46, 0, 2, '流程定义创建', NULL, '', 2, '', '', b'0', b'0', b'0', 'definition:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (124, 46, 0, 2, '流程定义修改', NULL, '', 3, '', '', b'0', b'0', b'0', 'definition:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (125, 46, 0, 2, '流程定义删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'definition:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (126, 48, 0, 2, '流程实例新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'instance:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (127, 48, 0, 2, '流程实例编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'instance:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (128, 48, 0, 2, '流程实例删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'instance:del', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (129, 49, 0, 2, '任务新增', NULL, '', 2, '', '', b'0', b'0', b'0', 'task:add', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (130, 49, 0, 2, '任务编辑', NULL, '', 3, '', '', b'0', b'0', b'0', 'task:edit', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (131, 49, 0, 2, '任务删除', NULL, '', 4, '', '', b'0', b'0', b'0', 'task:del', 'admin', NULL, now(), NULL);


INSERT INTO `sys_menu` VALUES (50, NULL, 4, 0, '我的任务', NULL, NULL, 17, 'peoples', 'myFlowable', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (51, 50, 0, 1, '发起流程', 'StartMyProcess', 'flowable/startMyProcess/index', 1, 'peoples', 'flowable/start', b'0', b'0', b'0', 'start:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (52, 50, 0, 1, '我的流程', 'MyProcess', 'flowable/myProcess/index', 1, 'peoples', 'myprocess', b'0', b'0', b'0', 'myprocess:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (53, 50, 0, 1, '我的待办', 'TaskTodo', 'flowable/taskTodo/index', 1, 'peoples', 'tasktodo', b'0', b'0', b'0', 'tasktodo:list', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (54, 50, 0, 1, '我的已办', 'TaskDone', 'flowable/taskDone/index', 1, 'peoples', 'taskdone', b'0', b'0', b'0', 'taskdone:list', 'admin', NULL, now(), NULL);



INSERT INTO `sys_menu` VALUES (55, 8, 0, 1, '服务监控', 'ServerMonitor', 'monitor/server/index', 14, 'codeConsole', 'server', b'0', b'0', b'0', 'monitor:list', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (56, 1, 3, 1, '任务调度', 'Quartz', 'system/quartz/index', 999, 'quartz', 'quartz', b'0', b'0', b'0', 'quartz:list', 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (57, 12, 0, 1, '代码生成', 'GeneratorIndex', 'generator/index', 32, 'dev', 'generator', b'0', b'1', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (58, 12, 0, 1, '生成配置', 'GeneratorConfig', 'generator/config', 33, 'dev', 'generator/config/:tableName', b'0', b'1', b'1', '', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (59, 12, 0, 1, '生成预览', 'Preview', 'generator/preview', 999, 'java', 'generator/preview/:tableName', b'0', b'1', b'1', NULL, 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (60, NULL, 5, 0, '组件管理', NULL, NULL, 50, 'zujian', 'components', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (61, 60, 0, 1, '图标库', 'Icons', 'components/icons/index', 51, 'icon', 'icon', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (62, 60, 0, 1, '富文本', 'Editor', 'components/Editor', 52, 'fwb', 'tinymce', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (63, 60, 0, 1, 'Markdown', 'Markdown', 'components/MarkDown', 53, 'markdown', 'markdown', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (64, 60, 0, 1, 'Yaml编辑器', 'YamlEdit', 'components/YamlEdit', 54, 'dev', 'yaml', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (65, 60, 0, 1, '图表库', 'Echarts', 'components/Echarts', 50, 'chart', 'echarts', b'0', b'1', b'0', NULL, 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (90, NULL, 5, 0, '运维管理', 'Mnt', '', 20, 'mnt', 'mnt', b'0', b'0', b'0', NULL, NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (92, 90, 3, 1, '服务器', 'ServerDeploy', 'mnt/server/index', 22, 'server', 'mnt/serverDeploy', b'0', b'0', b'0', 'serverDeploy:list', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (93, 90, 3, 1, '应用管理', 'App', 'mnt/app/index', 23, 'app', 'mnt/app', b'0', b'0', b'0', 'app:list', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (94, 90, 3, 1, '部署管理', 'Deploy', 'mnt/deploy/index', 24, 'deploy', 'mnt/deploy', b'0', b'0', b'0', 'deploy:list', NULL, NULL, '2019-11-10 15:56:55', NULL);
INSERT INTO `sys_menu` VALUES (97, 90, 1, 1, '部署备份', 'DeployHistory', 'mnt/deployHistory/index', 25, 'backup', 'mnt/deployHistory', b'0', b'0', b'0', 'deployHistory:list', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (98, 90, 3, 1, '数据库管理', 'Database', 'mnt/database/index', 26, 'database', 'mnt/database', b'0', b'0', b'0', 'database:list', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (102, 97, 0, 2, '删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deployHistory:del', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (103, 92, 0, 2, '服务器新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:add', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (104, 92, 0, 2, '服务器编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:edit', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (105, 92, 0, 2, '服务器删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'serverDeploy:del', NULL, NULL, '2019-11-17 11:09:15', NULL);
INSERT INTO `sys_menu` VALUES (106, 93, 0, 2, '应用新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:add', NULL, NULL, '2019-11-17 11:10:03', NULL);
INSERT INTO `sys_menu` VALUES (107, 93, 0, 2, '应用编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:edit', NULL, NULL, '2019-11-17 11:10:28', NULL);
INSERT INTO `sys_menu` VALUES (108, 93, 0, 2, '应用删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'app:del', NULL, NULL, '2019-11-17 11:10:55', NULL);
INSERT INTO `sys_menu` VALUES (109, 94, 0, 2, '部署新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:add', NULL, NULL, '2019-11-17 11:11:22', NULL);
INSERT INTO `sys_menu` VALUES (110, 94, 0, 2, '部署编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:edit', NULL, NULL, '2019-11-17 11:11:41', NULL);
INSERT INTO `sys_menu` VALUES (111, 94, 0, 2, '部署删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'deploy:del', NULL, NULL, '2019-11-17 11:12:01', NULL);
INSERT INTO `sys_menu` VALUES (112, 98, 0, 2, '数据库新增', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:add', NULL, NULL, '2019-11-17 11:12:43', NULL);
INSERT INTO `sys_menu` VALUES (113, 98, 0, 2, '数据库编辑', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:edit', NULL, NULL, '2019-11-17 11:12:58', NULL);
INSERT INTO `sys_menu` VALUES (114, 98, 0, 2, '数据库删除', NULL, '', 999, '', '', b'0', b'0', b'0', 'database:del', NULL, NULL, '2019-11-17 11:13:14', NULL);

INSERT INTO `sys_menu` VALUES (115, 44, 0, 1, '模型设计', 'Bpmn', 'flowable/model/bpmn', '1', 'peoples', 'flowable/model/bpmn/:id', b'0', b'1', b'1', NULL, 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (133, NULL, 1, 0, '消息管理', 'Mq', '', 20, 'message', 'mq', b'0', b'0', b'0', NULL, NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (134, 133, 3, 1, '集群管理', 'Cluster', 'mq/kafka/cluster/index', 22, 'tree', 'mq/cluster', b'0', b'0', b'0', 'cluster:list', NULL, NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (135, 133, 2, 0, '分类管理', NULL, '', 999, 'menu', 'mq/topic', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (136, 135, 0, 1, '我的消息', NULL, 'mq/kafka/topic/task', 999, 'qq', 'task', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (137, 135, 0, 1, 'Topics', NULL, 'mq/kafka/topic/index', 999, 'theme', 'index', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (138, 135, 0, 1, '生产消息', NULL, 'mq/kafka/topic/producer', 999, 'producer', 'mq/kafka/topic/producer/:topicId', b'0', b'1', b'1', '', 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (142, 135, 0, 1, '消息查询', NULL, 'mq/kafka/topic/consumer', 999, 'monitor', 'consumer', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);

INSERT INTO `sys_menu` VALUES (139, 133, 2, 0, '消息监控', NULL, '', 999, 'monitor', 'mq/monitor', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (140, 139, 0, 1, '生产监控', NULL, 'mq/kafka/monitor/producer', 999, 'monitor', 'producer', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);
INSERT INTO `sys_menu` VALUES (141, 139, 0, 1, '消费监控', NULL, 'mq/kafka/monitor/consumer', 999, 'monitor', 'consumer', b'0', b'0', b'0', NULL, 'admin', NULL, now(), NULL);



COMMIT;


/*==============================================================*/
/* Table: sys_role                                              */
/*==============================================================*/
create table sys_role
(
   role_id              bigint(20) not null auto_increment comment 'ID',
   name                 varchar(255) not null comment '名称',
   level                int(255) default NULL comment '角色级别',
   description          varchar(255) default NULL comment '描述',
   data_scope           varchar(255) default NULL comment '数据权限',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (role_id),
   key AK_Key_2 (name)
)
auto_increment = 3;

alter table sys_role comment '系统角色';

-- ----------------------------
-- Records of sys_role
-- ----------------------------
BEGIN;
INSERT INTO `sys_role` VALUES (1, '超级管理员', 1, '-', '全部', 'admin', NULL, now(), NULL);
INSERT INTO `sys_role` VALUES (2, '普通用户', 2, '-', '自定义', 'admin', NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_roles_depts                                       */
/*==============================================================*/
create table sys_roles_depts
(
   role_id              bigint(20) not null comment '角色ID',
   dept_id              bigint(20) not null comment '部门ID',
   primary key (role_id, dept_id),
   key AK_Key_2 (dept_id)
);

alter table sys_roles_depts comment '角色部门关联';

-- ----------------------------
-- Records of sys_roles_depts
-- ----------------------------
BEGIN;
INSERT INTO `sys_roles_depts` VALUES (2, 1);
COMMIT;

/*==============================================================*/
/* Table: sys_roles_menus                                       */
/*==============================================================*/
create table sys_roles_menus
(
   menu_id              bigint(20) not null comment '菜单ID',
   role_id              bigint(20) not null comment '角色ID',
   primary key (menu_id, role_id),
   key AK_Key_2 (role_id)
);

alter table sys_roles_menus comment '角色菜单关联';

-- ----------------------------
-- Records of sys_roles_menus
-- ----------------------------
BEGIN;
INSERT INTO `sys_roles_menus` VALUES (1, 1);
INSERT INTO `sys_roles_menus` VALUES (2, 1);
INSERT INTO `sys_roles_menus` VALUES (3, 1);
INSERT INTO `sys_roles_menus` VALUES (4, 1);
INSERT INTO `sys_roles_menus` VALUES (5, 1);
INSERT INTO `sys_roles_menus` VALUES (6, 1);
INSERT INTO `sys_roles_menus` VALUES (7, 1);
INSERT INTO `sys_roles_menus` VALUES (8, 1);
INSERT INTO `sys_roles_menus` VALUES (9, 1);
INSERT INTO `sys_roles_menus` VALUES (10, 1);
INSERT INTO `sys_roles_menus` VALUES (11, 1);
INSERT INTO `sys_roles_menus` VALUES (12, 1);
INSERT INTO `sys_roles_menus` VALUES (13, 1);
INSERT INTO `sys_roles_menus` VALUES (32, 1);
INSERT INTO `sys_roles_menus` VALUES (33, 1);
INSERT INTO `sys_roles_menus` VALUES (34, 1);
INSERT INTO `sys_roles_menus` VALUES (35, 1);
INSERT INTO `sys_roles_menus` VALUES (36, 1);
INSERT INTO `sys_roles_menus` VALUES (37, 1);
INSERT INTO `sys_roles_menus` VALUES (1, 2);
INSERT INTO `sys_roles_menus` VALUES (2, 2);
INSERT INTO `sys_roles_menus` VALUES (3, 2);
INSERT INTO `sys_roles_menus` VALUES (4, 2);
INSERT INTO `sys_roles_menus` VALUES (12, 2);
INSERT INTO `sys_roles_menus` VALUES (32, 2);
COMMIT;

/*==============================================================*/
/* Table: sys_user                                              */
/*==============================================================*/
create table sys_user
(
   user_id              bigint(20) not null auto_increment comment 'ID',
   dept_id              bigint(20) default NULL comment '部门名称',
   username             varchar(255) default NULL comment '用户名',
   nick_name            varchar(255) default NULL comment '昵称',
   gender               varchar(2) default NULL comment '性别',
   phone                varchar(255) default NULL comment '手机号码',
   email                varchar(255) default NULL comment '邮箱',
   avatar_name          varchar(255) default NULL comment '头像地址',
   avatar_path          varchar(255) default NULL comment '头像真实路径',
   password             varchar(255) default NULL comment '密码',
   is_admin             bit(1) default 0 comment '是否为admin账号',
   enabled              bigint(20) default NULL comment '状态：1启用、0禁用',
   create_by            varchar(255) comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   pwd_reset_time       datetime default NULL comment '修改密码的时间',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (user_id),
   unique key UK_Key_2 (email),
   unique key UK_Key_3 (username),
   key K_Key_4 (dept_id),
   key K_Key_5 (avatar_name),
   key K_Key_6 (enabled)
)
auto_increment = 3;

alter table sys_user comment '系统用户';

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` VALUES (1, 2, 'admin', '管理员', '男', '18988782166', 'herw@greatwall.com.cn', NULL, NULL, '$2a$10$Egp1/gvFlt7zhlXVfEFw4OfWQCGPw0ClmMcc6FjTnvXNRVf9zdMRa', b'1', 1, 'admin', NULL, NULL, now(), NULL);
INSERT INTO `sys_user` VALUES (2, 2, 'test', '测试', '男', '18988782166', 'template@greatwall.com.cn', NULL, NULL, '$2a$10$4XcyudOYTSz6fue6KFNMHeUQnCX5jbBQypLEnGk1PmekXt5c95JcK', b'0', 1, 'admin', NULL, NULL, now(), NULL);
COMMIT;

/*==============================================================*/
/* Table: sys_users_jobs                                        */
/*==============================================================*/
create table sys_users_jobs
(
   user_id              bigint(20) not null comment '用户ID',
   job_id               bigint(20) not null comment '岗位ID',
   primary key (user_id, job_id)
);

alter table sys_users_jobs comment '用户岗位关联';

-- ----------------------------
-- Records of sys_users_jobs
-- ----------------------------
BEGIN;
INSERT INTO `sys_users_jobs` VALUES (1, 2);
INSERT INTO `sys_users_jobs` VALUES (1, 3);
INSERT INTO `sys_users_jobs` VALUES (2, 3);
COMMIT;

/*==============================================================*/
/* Table: sys_users_roles                                       */
/*==============================================================*/
create table sys_users_roles
(
   user_id              bigint(20) not null comment '用户ID',
   role_id              bigint(20) not null comment '角色ID',
   primary key (user_id, role_id),
   key AK_Key_2 (role_id)
);

alter table sys_users_roles comment '用户角色管理';

-- ----------------------------
-- Records of sys_users_roles
-- ----------------------------
BEGIN;
INSERT INTO `sys_users_roles` VALUES (1, 1);
INSERT INTO `sys_users_roles` VALUES (2, 2);
COMMIT;

/*==============================================================*/
/* Table: tool_email_config                                     */
/*==============================================================*/
create table tool_email_config
(
   config_id            bigint(20) not null auto_increment comment 'ID',
   from_user            varchar(255) default NULL comment '收件人',
   host                 varchar(255) default NULL comment '邮件服务器SMTP地址',
   pass                 varchar(255) default NULL comment '密码',
   port                 varchar(255) comment '端口',
   user                 varchar(255) default NULL comment '发件者用户名',
   primary key (config_id)
);

alter table tool_email_config comment '邮箱配置';

-- ----------------------------
-- Records of tool_email_config
-- ----------------------------
BEGIN;
INSERT INTO `tool_email_config` VALUES (1, 'herw@greatwall.com.cn','mail.greatwall.com.cn','asdf.123','465','herw');
COMMIT;

drop table if exists form_making;

/*==============================================================*/
/* Table: form_making                                           */
/*==============================================================*/
create table form_making
(
   form_id              bigint(20) not null auto_increment,
   form_key             varchar(128) default NULL comment '表单KEY',
   form_name            varchar(128) default NULL comment '表单名称',
   form_content         longtext comment '表单内容json串',
   create_by            varchar(255) comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (form_id),
   unique key AK_Key_2 (form_key)
)
auto_increment = 1;

alter table form_making comment '流程表单vue-form-making';


drop table if exists sys_quartz_job;

/*==============================================================*/
/* Table: sys_quartz                                            */
/*==============================================================*/
create table sys_quartz_job
(
   job_id               bigint(20) not null auto_increment comment 'ID',
   bean_name            varchar(255) default NULL comment 'Spring Bean名称',
   cron_expression      varchar(255) default NULL comment 'cron 表达式',
   is_pause             bit(1) default NULL comment '状态：1暂停、0启用',
   job_name             varchar(255) default NULL comment '任务名称',
   method_name          varchar(255) default NULL comment '方法名称',
   params               varchar(255) default NULL comment '参数',
   description          varchar(255) default NULL comment '备注',
   person_in_charge     varchar(255) default NULL comment '负责人',
   email                varchar(64) default NULL comment '报警邮箱',
   sub_task             varchar(128) default NULL comment '子任务ID',
   pause_after_failure  bit(1) default NULL comment '任务失败后是否暂停',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          varchar(255) default NULL comment '创建日期',
   update_time          varchar(255) default NULL comment '更新时间',
   primary key (job_id),
   key AK_Key_2 (is_pause)
)
auto_increment = 1;

alter table sys_quartz_job comment '定时任务';


drop table if exists sys_quartz_log;

/*==============================================================*/
/* Table: sys_quartz_log                                        */
/*==============================================================*/
create table sys_quartz_log
(
   log_id               bigint(20) not null auto_increment comment 'ID',
   bean_name            varchar(255) default NULL comment 'Spring Bean名称',
   create_time          datetime default NULL comment '创建时间',
   cron_expression      varchar(255) default NULL comment 'cron 表达式',
   exception_detail     text comment '异常信息',
   is_success           bit(1) default NULL comment '是否成功',
   job_name             varchar(255) default NULL comment '任务名称',
   method_name          varchar(255) default NULL comment '方法名称',
   params               varchar(255) default NULL comment '参数',
   time                 bigint(20) default NULL comment '时间戳',
   primary key (log_id)
)
auto_increment = 1;

alter table sys_quartz_log comment '定时任务日志';


drop table if exists code_column_config;

/*==============================================================*/
/* Table: code_column_config                                    */
/*==============================================================*/
create table code_column_config
(
   column_id            bigint(20) not null auto_increment comment 'ID',
   table_name           varchar(255) default NULL comment '表名',
   column_name          varchar(255) default NULL comment '字段名称',
   column_type          varchar(255) default NULL comment '字段类型',
   dict_name            varchar(255) default NULL comment '字典名称',
   extra                varchar(255) default NULL comment '额外参数',
   form_show            bit(1) default NULL comment '是否表单显示',
   form_type            varchar(255) default NULL comment '表单类型',
   key_type             varchar(255) default NULL comment '字段键类型',
   list_show            bit(1) comment '是否在列表显示',
   not_null             bit(1) default NULL comment '是否必填',
   query_type           varchar(8) default NULL comment '查询 1:模糊 2：精确',
   remark               varchar(255) default NULL comment '字段描述',
   date_annotation      varchar(255) default NULL comment '日期注解',
   primary key (column_id),
   key AK_Key_2 (table_name)
);

alter table code_column_config comment '代码生成字段信息存储';


drop table if exists code_gen_config;

/*==============================================================*/
/* Table: code_gen_config                                       */
/*==============================================================*/
create table code_gen_config
(
   config_id            bigint(20) not null auto_increment comment 'ID',
   table_name           varchar(255) default NULL comment '表名',
   author               varchar(255) default NULL comment '作者',
   cover                bit(1) default NULL comment '是否覆盖',
   module_name          varchar(255) default NULL comment '模块名称',
   pack                 varchar(255) default NULL comment '包路径',
   path                 varchar(255) default NULL comment '前端代码生成的路径',
   api_path             varchar(255) default NULL comment '前端Api文件路径',
   prefix               varchar(255) default NULL comment '表前缀',
   api_alias            varchar(255) default NULL comment '接口名称',
   primary key (config_id),
   key AK_Key_2 (table_name)
);

alter table code_gen_config comment '代码生成器配置';


drop table if exists mnt_server;

/*==============================================================*/
/* Table: mnt_server                                            */
/*==============================================================*/
create table mnt_server
(
   server_id            bigint(20) not null auto_increment comment 'mnt_server',
   account              varchar(64) default NULL comment '账号',
   ip                   varchar(20) default NULL comment 'IP地址',
   name                 varchar(64) default NULL comment '名称',
   password             varchar(128) default NULL comment '密码',
   port                 int(5) default NULL comment '端口',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建时间',
   update_time          datetime default NULL comment '更新时间',
   primary key (server_id),
   key AK_Key_2 (ip)
);

alter table mnt_server comment '服务器管理';


drop table if exists mnt_deploy;

/*==============================================================*/
/* Table: mnt_deploy                                            */
/*==============================================================*/
create table mnt_deploy
(
   deploy_id            bigint(20) not null auto_increment comment 'ID',
   app_id               bigint(20) default NULL comment '应用编号',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建时间',
   update_time          datetime default NULL comment '更新时间',
   primary key (deploy_id),
   key AK_Key_2 (app_id)
);

alter table mnt_deploy comment '部署管理';

drop table if exists mnt_deploy_server;

/*==============================================================*/
/* Table: mnt_deploy_server                                     */
/*==============================================================*/
create table mnt_deploy_server
(
   deploy_id            bigint(20) not null comment '部署ID',
   server_id            bigint(20) not null comment '服务ID',
   primary key (deploy_id, server_id),
   key AK_Key_2 (server_id)
);

alter table mnt_deploy_server comment '应用与服务器关联';

drop table if exists mnt_deploy_history;

/*==============================================================*/
/* Table: mnt_deploy_history                                    */
/*==============================================================*/
create table mnt_deploy_history
(
   history_id           varchar(64) not null comment 'ID',
   app_name             varchar(255) default NULL comment '应用名称',
   deploy_date          datetime comment '部署日期',
   deploy_user          varchar(64) default NULL comment '部署用户',
   ip                   varchar(20) default NULL comment '服务器IP',
   deploy_id            bigint(20) default NULL comment '部署编号',
   primary key (history_id)
);

alter table mnt_deploy_history comment '部署历史管理';

drop table if exists mnt_database;

/*==============================================================*/
/* Table: mnt_database                                          */
/*==============================================================*/
create table mnt_database
(
   db_id                varchar(64) not null comment 'ID',
   name                 varchar(255) default NULL comment '名称',
   jdbc_url             varchar(255) default NULL comment 'jdbc连接',
   user_name            varchar(255) default NULL comment '账号',
   pwd                  varchar(255) default NULL comment '密码',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建时间',
   update_time          datetime default NULL comment '更新时间',
   primary key (db_id)
);

alter table mnt_database comment '数据库管理';


drop table if exists mnt_app;

/*==============================================================*/
/* Table: mnt_app                                               */
/*==============================================================*/
create table mnt_app
(
   app_id               bigint(20) not null auto_increment comment 'ID',
   name                 varchar(255) default NULL comment '应用名称',
   upload_path          varchar(255) default NULL comment '上传目录',
   deploy_path          varchar(255) default NULL comment '部署路径',
   backup_path          varchar(255) default NULL comment '备份路径',
   port                 int(5) default NULL comment '应用端口',
   start_script         varchar(4000) default NULL comment '启动脚本',
   deploy_script        varchar(4000) default NULL comment '部署脚本',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (app_id)
);

alter table mnt_app comment '应用管理';


drop table if exists oauth_client_details;

/*==============================================================*/
/* Table: oauth_client_details                                  */
/*==============================================================*/
create table oauth_client_details
(
   client_id            varchar(255) not null comment 'ID',
   resource_ids         varchar(255) comment 'resource_ids',
   client_secret        varchar(255),
   scope                varchar(255),
   authorized_grant_types varchar(255),
   web_server_redirect_uri varchar(255),
   authorities          varchar(255),
   access_token_validity integer,
   refresh_token_validity integer,
   additional_information varchar(4096),
   autoapprove          varchar(255),
   primary key (client_id)
);

alter table oauth_client_details comment '客户端详情';

INSERT INTO `oauth_client_details` VALUES('mobile-client', 'greatwall', '$2a$10$uLvpxfvm3CuUyjIvYq7a9OUmd9b3tHFKrUaMyU/jC01thrTdkBDVm', 'read', 'password,refresh_token', null, 'ROLE_CLIENT', null, null, null, 0);


drop table if exists oauth_client_token;

/*==============================================================*/
/* Table: oauth_client_token                                    */
/*==============================================================*/
create table oauth_client_token
(
   authentication_id    varchar(255) not null,
   token_id             varchar(255),
   token                longtext,
   user_name            varchar(255),
   client_id            varchar(255),
   primary key (authentication_id)
);

alter table oauth_client_token comment 'oauth_client_token';


drop table if exists oauth_access_token;

/*==============================================================*/
/* Table: oauth_access_token                                    */
/*==============================================================*/
create table oauth_access_token
(
   authentication_id    varchar(255) not null,
   token_id             varchar(255),
   token                longtext,
   user_name            varchar(255),
   client_id            varchar(255),
   authentication       longtext,
   refresh_token        varchar(255),
   primary key (authentication_id)
);

alter table oauth_access_token comment 'oauth_access_token';


drop table if exists oauth_refresh_token;

/*==============================================================*/
/* Table: oauth_refresh_token                                   */
/*==============================================================*/
create table oauth_refresh_token
(
   token_id             varchar(255),
   token                longtext,
   authentication       longtext
);

alter table oauth_refresh_token comment 'oauth_refresh_token';


drop table if exists oauth_code;

/*==============================================================*/
/* Table: oauth_code                                            */
/*==============================================================*/
create table oauth_code
(
   code                 varchar(255) comment 'code',
   authentication       longtext comment 'authentication'
);

alter table oauth_code comment 'oauth_code';


drop table if exists oauth_approvals;

/*==============================================================*/
/* Table: oauth_approvals                                       */
/*==============================================================*/
create table oauth_approvals
(
   userId               varchar(255),
   clientId             varchar(255),
   scope                varchar(255),
   status               varchar(10),
   expiresAt            timestamp,
   lastModifiedAt       timestamp
);

alter table oauth_approvals comment 'oauth_approvals';

-- customized oauth_client_details table
create table ClientDetails (
  appId VARCHAR(256) PRIMARY KEY,
  resourceIds VARCHAR(256),
  appSecret VARCHAR(256),
  scope VARCHAR(256),
  grantTypes VARCHAR(256),
  redirectUrl VARCHAR(256),
  authorities VARCHAR(256),
  access_token_validity INTEGER,
  refresh_token_validity INTEGER,
  additionalInformation VARCHAR(4096),
  autoApproveScopes VARCHAR(256)
);

/*==============================================================*/
/* Table: mq_cluster                                            */
/*==============================================================*/
create table mq_cluster
(
   cluster_id           bigint(20) not null auto_increment,
   name                 varchar(255) default NULL comment '集群名称',
   zk_address           varchar(255) default NULL comment 'ZooKeeper地址',
   broker               varchar(255) default NULL comment 'Kafka缓存代理',
   broker_size          int(4) default 0 comment '缓存大小',
   kafka_version        varchar(64) default NULL comment 'Kafka版本',
   enable               bit(1) default NULL comment '高级设置',
   location             varchar(64) default NULL comment '配置环境',
   grafana_address      varchar(255) default NULL comment 'Grafana地址',
   comments             varchar(255) comment '备注',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (cluster_id)
)
auto_increment = 1;

alter table mq_cluster comment 'Kafka集群';


drop table if exists mq_topic;

/*==============================================================*/
/* Table: mq_topic                                              */
/*==============================================================*/
create table mq_topic
(
   topic_id             bigint(20) not null auto_increment,
   cluster_id           bigint(20) default NULL comment '集群名称',
   name                 varchar(255) comment '主题名称',
   `partition`            int(11) default NULL comment 'partition',
   `replication`          int(11) default NULL comment 'replication',
   ttl                  int(11) default NULL comment 'ttl',
   config               varchar(512) default NULL comment 'config',
   file_size            bigint(20) default -1 comment 'file_size',
   comments             varchar(255) comment '备注',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (topic_id)
)
auto_increment = 1;

alter table mq_topic comment '消息分类';



drop table if exists mq_task;

/*==============================================================*/
/* Table: mq_task                                               */
/*==============================================================*/
create table mq_task
(
   task_id              bigint(20) not null auto_increment,
   cluster_ids          bigint(20) default NULL comment '集群名称',
   role_id              bigint(20) default NULL comment '角色',
   `name`                 varchar(255) comment '主题名称',
   `partition`          int(11) default NULL comment 'partition',
   `replication`          int(11) default NULL comment 'replication',
   message_rate         bigint(50) default NULL comment 'message_rate',
   ttl                  int(11) default NULL comment 'ttl',
   approved             int(11) default NULL comment 'approved',
   approval_opinions    varchar(2048) comment 'approval_opinions',
   location             varchar(64) default NULL comment '配置环境',
   comments             varchar(255) comment '备注',
   create_by            varchar(255) default NULL comment '创建者',
   update_by            varchar(255) default NULL comment '更新者',
   create_time          datetime default NULL comment '创建日期',
   update_time          datetime default NULL comment '更新时间',
   primary key (task_id)
)
auto_increment = 1;

alter table mq_task comment '消息任务';




SET FOREIGN_KEY_CHECKS = 1;